
package cn.edu.scau.cmi.hombio.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import org.codehaus.jackson.annotate.JsonIgnore;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllMedicineTakeDetails", query = "select myMedicineTakeDetail from MedicineTakeDetail myMedicineTakeDetail"),
		@NamedQuery(name = "findMedicineTakeDetailByBoxTraceCode", query = "select myMedicineTakeDetail from MedicineTakeDetail myMedicineTakeDetail where myMedicineTakeDetail.boxTraceCode = ?1"),
		@NamedQuery(name = "findMedicineTakeDetailByBoxTraceCodeContaining", query = "select myMedicineTakeDetail from MedicineTakeDetail myMedicineTakeDetail where myMedicineTakeDetail.boxTraceCode like ?1"),
		@NamedQuery(name = "findMedicineTakeDetailByCaseTraceCode", query = "select myMedicineTakeDetail from MedicineTakeDetail myMedicineTakeDetail where myMedicineTakeDetail.caseTraceCode = ?1"),
		@NamedQuery(name = "findMedicineTakeDetailByCaseTraceCodeContaining", query = "select myMedicineTakeDetail from MedicineTakeDetail myMedicineTakeDetail where myMedicineTakeDetail.caseTraceCode like ?1"),
		@NamedQuery(name = "findMedicineTakeDetailById", query = "select myMedicineTakeDetail from MedicineTakeDetail myMedicineTakeDetail where myMedicineTakeDetail.id = ?1"),
		@NamedQuery(name = "findMedicineTakeDetailByIsBox", query = "select myMedicineTakeDetail from MedicineTakeDetail myMedicineTakeDetail where myMedicineTakeDetail.isBox = ?1"),
		@NamedQuery(name = "findMedicineTakeDetailByPrimaryKey", query = "select myMedicineTakeDetail from MedicineTakeDetail myMedicineTakeDetail where myMedicineTakeDetail.id = ?1"),
		@NamedQuery(name = "findMedicineTakeDetailByTraceCode", query = "select myMedicineTakeDetail from MedicineTakeDetail myMedicineTakeDetail where myMedicineTakeDetail.traceCode = ?1"),
		@NamedQuery(name = "findMedicineTakeDetailByTraceCodeContaining", query = "select myMedicineTakeDetail from MedicineTakeDetail myMedicineTakeDetail where myMedicineTakeDetail.traceCode like ?1") })

@Table(catalog = "pig", name = "medicine_take_detail")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "pigRs/cn/edu/scau/cmi/hombio/domain", name = "MedicineTakeDetail")

public class MedicineTakeDetail implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "Id", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@Id @GeneratedValue
	@XmlElement
	Integer id;
	/**
	 */

	@Column(name = "TraceCode", length = 24)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	String traceCode;
	/**
	 */

	@Column(name = "BoxTraceCode", length = 24)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	String boxTraceCode;
	/**
	 */

	@Column(name = "CaseTraceCode", length = 24)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	String caseTraceCode;
	/**
	* Ĭ��f�Ǻ�װ��ȡ����ֻ��ȡ
	* 
	 */

	@Column(name = "IsBox")
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	Integer isBox;

	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "MedicineTakeId", referencedColumnName = "Id") })
	@XmlTransient
	MedicineTake medicineTake;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "MedicineId", referencedColumnName = "Id", nullable = false) })
	@XmlTransient
	Medicine medicine;

	/**
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 */
	public Integer getId() {
		return this.id;
	}

	/**
	 */
	public void setTraceCode(String traceCode) {
		this.traceCode = traceCode;
	}

	/**
	 */
	public String getTraceCode() {
		return this.traceCode;
	}

	/**
	 */
	public void setBoxTraceCode(String boxTraceCode) {
		this.boxTraceCode = boxTraceCode;
	}

	/**
	 */
	public String getBoxTraceCode() {
		return this.boxTraceCode;
	}

	/**
	 */
	public void setCaseTraceCode(String caseTraceCode) {
		this.caseTraceCode = caseTraceCode;
	}

	/**
	 */
	public String getCaseTraceCode() {
		return this.caseTraceCode;
	}

	/**
	* Ĭ��f�Ǻ�װ��ȡ����ֻ��ȡ
	* 
	 */
	public void setIsBox(Integer isBox) {
		this.isBox = isBox;
	}

	/**
	* Ĭ��f�Ǻ�װ��ȡ����ֻ��ȡ
	* 
	 */
	public Integer getIsBox() {
		return this.isBox;
	}

	/**
	 */
	public void setMedicineTake(MedicineTake medicineTake) {
		this.medicineTake = medicineTake;
	}

	/**
	 */
	@JsonIgnore
	public MedicineTake getMedicineTake() {
		return medicineTake;
	}

	/**
	 */
	public void setMedicine(Medicine medicine) {
		this.medicine = medicine;
	}

	/**
	 */
	@JsonIgnore
	public Medicine getMedicine() {
		return medicine;
	}

	/**
	 */
	public MedicineTakeDetail() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(MedicineTakeDetail that) {
		setId(that.getId());
		setTraceCode(that.getTraceCode());
		setBoxTraceCode(that.getBoxTraceCode());
		setCaseTraceCode(that.getCaseTraceCode());
		setIsBox(that.getIsBox());
		setMedicineTake(that.getMedicineTake());
		setMedicine(that.getMedicine());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("id=[").append(id).append("] ");
		buffer.append("traceCode=[").append(traceCode).append("] ");
		buffer.append("boxTraceCode=[").append(boxTraceCode).append("] ");
		buffer.append("caseTraceCode=[").append(caseTraceCode).append("] ");
		buffer.append("isBox=[").append(isBox).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((id == null) ? 0 : id.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof MedicineTakeDetail))
			return false;
		MedicineTakeDetail equalCheck = (MedicineTakeDetail) obj;
		if ((id == null && equalCheck.id != null) || (id != null && equalCheck.id == null))
			return false;
		if (id != null && !id.equals(equalCheck.id))
			return false;
		return true;
	}
}
